package com.aw.baselib.bean;

import android.os.Parcel;
import android.os.Parcelable;

import com.aw.baselib.util.AwDataUtil;

public class CommonImgItemBean implements Parcelable {

    //图片路径
    private String imgPath ;
    //图片描述
    private String describe ;
    private int resId;

    public CommonImgItemBean(){}

    public CommonImgItemBean(String url) {
        this.imgPath = url;
    }

    public CommonImgItemBean(String describe, int resId) {
        this.describe = describe;
        this.resId = resId;
    }

    public CommonImgItemBean(String describe, String imgPath) {
        this.describe = describe;
        this.imgPath = imgPath;
    }

    protected CommonImgItemBean(Parcel in) {
        imgPath = in.readString();
        describe = in.readString();
        resId = in.readInt();
    }

    public boolean isAdd() {
        if(!AwDataUtil.isEmpty(imgPath) && imgPath.equals("default")) {
            return true;
        }
        return false;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(imgPath);
        dest.writeString(describe);
        dest.writeInt(resId);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<CommonImgItemBean> CREATOR = new Creator<CommonImgItemBean>() {
        @Override
        public CommonImgItemBean createFromParcel(Parcel in) {
            return new CommonImgItemBean(in);
        }

        @Override
        public CommonImgItemBean[] newArray(int size) {
            return new CommonImgItemBean[size];
        }
    };

    public String getImgPath() {
        return imgPath;
    }

    public void setImgPath(String imgPath) {
        this.imgPath = imgPath;
    }

    public String getDescribe() {
        return describe;
    }

    public void setDescribe(String describe) {
        this.describe = describe;
    }

    public int getResId() {
        return resId;
    }

    public void setResId(int resId) {
        this.resId = resId;
    }

    @Override
    public String toString() {
        return "CommonImgItemBean{" +
                "imgPath='" + imgPath + '\'' +
                ", describe='" + describe + '\'' +
                ", resId=" + resId +
                '}';
    }
}
